<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
	<style>
	body{
	background: radial-gradient(ellipse at 50% 50%,#00a38d 0,#1e5899 100%,#efefef);
	}	
	</style>
<link href="${path }/resource/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body class="gray-bg">
	<div class="warp"></div>
	<!--top  -->
	<div class="top-title">
			客户反馈系统
	</div>
	<div class="m-content container">	
		<input type="hidden" name="projId" value="${param.projId}" id="projId">
	
		<h4 class="title text-center" >问题反馈列表</h4>
		<a href="${path }/feedback/client/redirect/proble_feedback_list?title=1&projId=${param.projId}" class="m-goBack">
				返回上层</a>
		<button onclick="openAdd()" type="button" class="m-fr  btn btn-success btn-sm float-right"><i class="fa fa-plus" ></i>  新增</button>		
		
		<form class="form-inline" id="serchform">
				
				<label for="exampleInputName2">标题</label>
				<div class="form-group mr-20">					
					<div class="col-sm-4 ">
						<input type="text" class="form-control" name="title" style="width: 180px;">
					</div>
				</div>

				<label for="exampleInputName2">所属模块</label>
				<div class="form-group mr-20">
					<div class="col-sm-4 ">
						<select class="form-control select2" size="1" name="interfaceId"
							id="parentId" style="width: 180px;">
							<option value="" selected="selected">--请选择项目模块--</option>
						</select>
					</div>
				</div>

				<label for="exampleInputName2">处理结果</label>
				<div class="form-group mr-20">
					<div class="col-sm-4 ">
						<select class="form-control autoFull select2" name="handleResult"
							data-url="${path}/admin/dataDictionary/showDataDictionary" 
							data-filed="name" 
							data-value="name"
							data-param="{type:'问题处理结果'}"
							style="width: 180px;"
							>
							<option value="">--请选择处理结果--</option>
						</select>
					</div>
				</div> 
				
				<label for="exampleInputName2">创建时间</label>
				<div class="form-group mr-20">					
					<div class="col-sm-4 ">
						<input type="text" dataType="*" class="form-control datetimepicker"
							name="createTime" style="width: 180px;">
					</div>
				</div> 
			
				<button onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm">
					<i class="fa fa-search "></i> 搜索
				</button>
				<button type="button" onclick="MForm.reset('#serchform')" class="btn btn-info btn-sm">
					<i class="fa fa-refresh "></i> 重置
				</button>
			</form>
		
		<table id="mgrid" >
			<thead>
				<tr>					
					<th data-field="title" >标题</th>
					<th data-field="interfaceName" >所属模块</th>					
					<th data-field="createClientName" >创建人</th>
					<th data-field="createTime" data-formatter="MGrid.getTimeDD" >创建时间</th>
					<th data-field="handleResult" data-formatter="changeResultStyle" >处理结果</th>
					<th data-align="center"  data-width="130px" data-field="id" data-formatter="buidOperate">操作</th>
				</tr>
			</thead>
		</table>
	</div>
	     
	<script type="text/javascript">
		//初始化表格
		var myGrid;
		$(function(){
			MTools.autoFullSelect();
			MTools.ininDatetimepicker({
				maxView : 3,
				minView : 2,
				listenBlur : true,
			});	
			//带搜索的下拉框
			$(".select2").select2({'width':'180px;'});
			$(".select2").trigger("blur");
			
			 var projId = ${param.projId};
			 initFunctionList(projId);
			 myGrid=MGrid.initGrid({
				 url:"${path}/feedback/clientchanges/showList?projId="+projId,				 
				 showColumns : false,// 显示选择显示列按钮
				 showRefresh : false,				
				 showToggle : false,
			 });
		});

		function changeResultStyle(value, row, index){
			var html="";
			if(value == '不予处理'){
				html = '<span class="badge badge-danger">'+value+'</span>';
			}else if(value == '已处理完毕'){
				html = '<span class="badge badge-success">'+value+'</span>';
			}else if(value == '已安排处理'){
				html = '<span class="badge badge-info">'+value+'</span>';
			}
			else if(value == '与客户确认中'){
				html = '<span class="badge badge-info">'+value+'</span>';
			}else{
				html = '<span class="badge badge-warning">'+value+'</span>';
			}
			return html;
		}
		
		function buidOperate(value, row, index){
			var html='';
			if(row.handleResult == '待处理'){
				html+='<button class="btn btn-default btn-sm mr-5" onClick="openEdit('+value+')"  title="编辑"><i class="fa fa-edit"></i></buttoun>';
			}else{
				html+='<button class="btn btn-default btn-sm mr-5" onClick="openEdit2('+value+')"  title="再次处理"><i class="fa  fa-share"></i></buttoun>';
			}		
			
			html+='<button class="btn btn-default btn-sm mr-5" onClick="openLook('+value+')"  title="查看详情"><i class="fa fa-search"></i></buttoun>';			
			return html; 
		}
		
		//打开添加页面页面		
		function openAdd() {
			var projId = $("#projId").val();
		layer.full(	layer.open({
				type : 2,
				title : "添加反馈信息",
				area : [ MUI.SIZE_L, '540px' ],
				maxmin : true,
				content : [ '${path}/feedback/clientchanges/editForm?projId=' + projId]
			}));
		}
		
		
		//打开编辑界面		
		function openEdit(id) {
			layer.full(layer.open({
				type : 2,
				title : "编辑反馈信息",
				area : [ MUI.SIZE_L, '700px' ],
				maxmin : true,
				content : [ '${path}/feedback/clientchanges/editForm?id=' + id]
			}));
		}
		

		//重新处理	
		function openEdit2(id) {
			layer.full(layer.open({
				type : 2,
				title : "再次处理",
				area : [ MUI.SIZE_L, '700px' ],
				maxmin : true,
				content : [ '${path}/feedback/clientchanges/editForm?optoinType=2&id=' + id]
			}));
		}
		
		//打开查看界面		
		function openLook(id) {
			layer.full(layer.open({
				type : 2,
				title : "查看项目信息",
				area : [ MUI.SIZE_L, '700px' ],
				maxmin : true,
				content : [ '${path}/feedback/clientchanges/showFeedback?id=' + id]
			}));
		}
		
		function initFunctionList(projId) {
			$.AjaxProxy({
				a : true,
				c : false
			}).invoke(
				"${path}/feedback/clientchanges/showCateList?projId="+projId,
				function(loj) {
					$("#parentId").createSelectTree(
						loj.attr("result").rows, {
							append : true ,
						});
					});	
		}
		
		
		
	</script>
</body>
</html>
